//轮播图
var mySwiper = new Swiper('.swiper-container', {
      loop: true,
      navigation: {
            nextEl: '.swiper-button-next',
            prevEl: '.swiper-button-prev',
      },
      autoplay: true,

});
//懒加载
$(function () {
      $(".lazy").lazyload();
})
//吸顶菜单
window.onscroll = function () {
      var scrollTop = document.body.scrollTop || document.documentElement.scrollTop;

      if (scrollTop > 80) {
            Ceiling.style.position = "fixed";
      } else {
            Ceiling.style.position = "static";
      }
}
//楼梯
$(function () {
      let top_list = [];
      let $contents = $(".content");
      let animate = false;

      $.each($contents, function (index, ele) {
            top_list.push($(ele).offset().top);
      })

      $(".btn-list li").click(function () {
            changeClass.call(this)
            var index = $(this).index(".btn-list li");
            animate = true;
            changeScrollTop(index);
      })

      function changeClass() {
            $(this)
                  .addClass("active")
                  .siblings()
                  .removeClass("active")
      }

      function changeScrollTop(index) {
            $("html,body")
                  .stop(true)
                  .animate({
                        scrollTop: top_list[index] + 2
                  }, function () {
                        animate = false;
                  })
      }


      $(window).scroll(function () {
            if (!animate) {
                  var index = getIndex();
                  changeBtnClass(index);
            }
      });

      function getIndex() {
            var scrollTop = $("html,body").scrollTop();

            if (scrollTop >= top_list[top_list.length - 1]) {
                  return top_list.length - 1;
            }
            for (let i = 0; i < top_list.length; i++) {
                  if (scrollTop >= top_list[i] && scrollTop < top_list[i + 1]) {
                        return i;
                  }
            }
      }


      function changeBtnClass(index) {
            $(".btn-list li")
                  .removeClass("active")
                  .eq(index)
                  .addClass("active")
      }

      $(window).trigger("scroll");
})


//搜索图标
var lis=document.querySelector(".list3")
var aaa=document.querySelector(".aaa")
var eee=document.querySelector(".eee")
lis.onclick=function(){
      aaa.style.display="block";
}
eee.onclick = function(){
      aaa.style.display="none";
}



